var time_id = null;

function animate(element,current,target,step){
  if(element.time_id){
      clearInterval(element.time_id);
      element.time_id = null;
  }
  element.time_id = setInterval(function(){
    if(current >= target){
      current = target;
      clearInterval(element.time_id)
    }else{
      current += step;
    }
    element.style.left = current + 'px';
  },30);
}
